#pragma once
#ifndef _MYGLSTRINGCONTROL_H
#define _MYGLSTRINGCONTROL_H

#include <windows.h>
#include <GdiPlus.h>
#include <gl/glut.h>
#include <vector>

#include "Ptr.hpp"
#include "ShowListManager.h"

using namespace Gdiplus;
using namespace std;


class myglStringControl
{
private:
  GLuint _texName[128];
  GLuint _showListName[128];
  UINT _fontWidth[128];
  UINT _fontHeight;
  Ptr< ShowListManager > _pShowListMng;

  void _bind_tex_and_draw (char, BitmapData&);
  void _create_character_list (const WCHAR* strFontFamily, UINT fontSize);

public:
  enum AlignMode { ALIGN_LEFT, ALIGN_RIGHT, ALIGN_MIDDLE };

  myglStringControl (const WCHAR* strFontFamily, UINT fontSize,
                     Ptr< ShowListManager > pShowListMng);
  ~myglStringControl ();

  // height is the actual height you want to draw
  // length is the string's characters. If str is a Null-terminate string,
  //   You can leave this default.
  // charSpacePercent is the space between characters.
  //   its value is the percent of font height, range from 0 to 1
  void DrawString (const char* str, GLfloat height,
                   AlignMode mode = ALIGN_MIDDLE,
                   float charSpacePercent = 0,
                   UINT length = -1, GLfloat hwRatio = 1);
};

#endif